#ifndef __TRIANGLE_ENERGIES_NURBS__
#define __TRIANGLE_ENERGIES_NURBS__

#include "optimizer.h"

namespace Optimizer {	
	class BendingEnergyEdgeEvaluator : public PrimitiveEvaluator {
		public:
			virtual nfloat f(const Attribute& attribute) const; 
			virtual Vector Gradient(const Attribute& attribute) const; 
			virtual Matrix Hessian(const Attribute& attribute) const; 
		protected:
	};
	
	class OrthogonalityEnergyTriangleEvaluator : public PrimitiveEvaluator {
		public:
			virtual nfloat f(const Attribute& attribute) const; 
			virtual Vector Gradient(const Attribute& attribute) const; 
			virtual Matrix Hessian(const Attribute& attribute) const; 
		protected:
			nfloat Angle(const Vec2n& u, const Vec2n& v) const {
				return math::dot((1.0 / length(u)) * u, (1.0 / length(v)) * v);
			}
	};
	
	class BoundaryOrthogonalityEnergyTriangleEvaluator : public PrimitiveEvaluator {
		public:
			virtual nfloat f(const Attribute& attribute) const; 
			virtual Vector Gradient(const Attribute& attribute) const; 
			virtual Matrix Hessian(const Attribute& attribute) const; 
		protected:
			nfloat Angle(const Vec2n& u, const Vec2n& v) const {
				return math::dot((1.0 / length(u)) * u, (1.0 / length(v)) * v);
			}
	};

	class IsometricEnergyTriangleEvaluator : public PrimitiveEvaluator {
		public:
			virtual nfloat f(const Attribute& attribute) const; 
			virtual Vector Gradient(const Attribute& attribute) const; 
			virtual Matrix Hessian(const Attribute& attribute) const; 
		protected:
	};
	
	class DeformationEnergyTriangleEvaluator : public PrimitiveEvaluator {
		public:
			virtual nfloat f(const Attribute& attribute) const; 
			virtual Vector Gradient(const Attribute& attribute) const; 
			virtual Matrix Hessian(const Attribute& attribute) const; 
		protected:
	};
	
	class StretchEnergyTriangleEvaluator : public PrimitiveEvaluator {
		public:
			virtual nfloat f(const Attribute& attribute) const; 
			virtual Vector Gradient(const Attribute& attribute) const; 
			virtual Matrix Hessian(const Attribute& attribute) const; 
		protected:
	};
}

#endif //__TRIANGLE_ENERGIES_NURBS__
